package com.lz.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

@WebFilter("/user/*")
public class DemoFilter implements Filter {
    public void init(FilterConfig filterConfig) throws ServletException {
        Filter.super.init(filterConfig);
        System.out.println("DemoFilter 初始化...");
    }

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException {
        System.out.println("二道河子前");
        chain.doFilter(request, response);
        System.out.println("二道盒子后");
    }

    public void destroy() {
        System.out.println("DemoFilter 销毁...");
        Filter.super.destroy();
    }
}